﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace PdfLibrary
{
    public class PdfRectangle
    {
        public double MinX;
        public double MaxX;
        public double MinY;
        public double MaxY;

        public PdfRectangle(PdfArray array)
        {
            // ll = lower-left, ur = upper-right
            double llX = ((PdfNumber)array[0]).value;
            double llY = ((PdfNumber)array[1]).value;
            double urX = ((PdfNumber)array[2]).value;
            double urY = ((PdfNumber)array[3]).value;

            MinX = llX < urX ? llX : urX;
            MinY = llY < urY ? llY : urY;
            MaxX = llX < urX ? urX : llX;
            MaxY = llY < urY ? urY : llY;
        }

        public double Width { get { return MaxX - MinX; } }
        public double Height { get { return MaxY - MinY; } }
    }
}
